/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.manage.convertor;

import cn.hutool.core.bean.BeanUtil;
import info.peigen.hotpot.business.customer.core.domain.CustomerTech;
import info.peigen.hotpot.business.customer.core.repository.entity.CustomerTechEntity;
import info.peigen.hotpot.business.customer.manage.form.CustomerTechManageCreateForm;
import info.peigen.hotpot.business.customer.manage.form.CustomerTechManageEditForm;
import info.peigen.hotpot.business.customer.manage.form.CustomerTechManageSearchForm;
import info.peigen.hotpot.business.customer.manage.info.CustomerTechManageInfo;
import info.peigen.hotpot.common.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * <b>(CustomerTechManageConvertor)</b>
 * 管理后台领域对象 "客户模块与技术相关的内容" 转换器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-09-09
 */
@SuppressWarnings("unused")
@Slf4j
public class CustomerTechManageConvertor {
    // ConvertToEntity
    public static CustomerTechEntity convertToEntity(CustomerTech domain) {
        return BeanUtil.copyProperties(domain, CustomerTechEntity.class);
    }

    public static CustomerTechEntity convertToEntity(CustomerTechManageInfo info) {
        return BeanUtil.copyProperties(info, CustomerTechEntity.class);
    }

    public static CustomerTechEntity convertToEntity(CustomerTechManageSearchForm form) {
        return BeanUtil.copyProperties(form, CustomerTechEntity.class);
    }

    public static CustomerTechEntity convertToEntity(CustomerTechManageCreateForm form) {
        if (form.getCustomerId() == null) {
            form.setCustomerId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, CustomerTechEntity.class);
    }

    public static CustomerTechEntity convertToEntity(CustomerTechManageEditForm form) {
        return BeanUtil.copyProperties(form, CustomerTechEntity.class);
    }

    // ConvertToDomain
    public static CustomerTech convertToDomain(CustomerTechEntity entity) {
        return BeanUtil.copyProperties(entity, CustomerTech.class);
    }

    public static CustomerTech convertToDomain(CustomerTechManageInfo info) {
        return BeanUtil.copyProperties(info, CustomerTech.class);
    }

    public static CustomerTech convertToDomain(CustomerTechManageSearchForm form) {
        return BeanUtil.copyProperties(form, CustomerTech.class);
    }

    public static CustomerTech convertToDomain(CustomerTechManageCreateForm form) {
        if (form.getCustomerId() == null) {
            form.setCustomerId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, CustomerTech.class);
    }

    public static CustomerTech convertToDomain(CustomerTechManageEditForm form) {
        return BeanUtil.copyProperties(form, CustomerTech.class);
    }

    // convertToInfo
    public static CustomerTechManageInfo convertToInfo(CustomerTech domain) {
        return BeanUtil.copyProperties(domain, CustomerTechManageInfo.class);
    }

    public static CustomerTechManageInfo convertToInfo(CustomerTechEntity entity) {
        return BeanUtil.copyProperties(entity, CustomerTechManageInfo.class);
    }

    public static CustomerTechManageInfo convertToInfo(CustomerTechManageSearchForm form) {
        return BeanUtil.copyProperties(form, CustomerTechManageInfo.class);
    }

    public static CustomerTechManageInfo convertToInfo(CustomerTechManageCreateForm form) {
        if (form.getCustomerId() == null) {
            form.setCustomerId(IdUtil.id());
        }
        return BeanUtil.copyProperties(form, CustomerTechManageInfo.class);
    }

    public static CustomerTechManageInfo convertToInfo(CustomerTechManageEditForm form) {
        return BeanUtil.copyProperties(form, CustomerTechManageInfo.class);
    }
}